package com.slz3.business.module.wmsManagement.wmsWarningConfig.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsWarningConfig.domain.WmsWarningConfig;
import com.slz3.business.module.wmsManagement.wmsWarningConfig.domain.WmsWarningConfigFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsWarningConfigTransactionalServiceImpl implements WmsWarningConfigTransactionalService {

    @Override
    public WmsWarningConfig modify(WmsWarningConfig wmsWarningConfigNew) {
        Repositorys.wmsWarningConfig.test();
        Repositorys.wmsWarningConfig.save(WmsWarningConfigFactory.initBaseFields());
        System.err.println(1 / 0);
        wmsWarningConfigNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsWarningConfig.saveAndFlush(wmsWarningConfigNew);
    }

    @Override
    public List<WmsWarningConfig> batchModify(List<WmsWarningConfig> wmsWarningConfigList) {
        return Repositorys.wmsWarningConfig.saveAll(wmsWarningConfigList);
    }
}
